import request from '@/router/axios';

// 列表
export const getList = (current, size, params) => {
  return request({
    url: '/api/riskPoint/riskmanagement/page',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

// 详情
export const getDetail = (id) => {
  return request({
    url: '/api/riskPoint/riskmanagement/detail',
    method: 'get',
    params: {
      id
    }
  })
}

// 删除
export const remove = (ids) => {
  return request({
    url: '/api/riskPoint/riskmanagement/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

// 新增
export const add = (row) => {
  return request({
    url: '/api/riskPoint/riskmanagement/save',
    method: 'post',
    data: row
  })
}

// 修改
export const update = (row) => {
  return request({
    url: '/api/riskPoint/riskmanagement/update',
    method: 'post',
    data: row
  })
}

// 获取所属部门
export const getDeptList = (tenantId) => { 
  return request({
    url: '/api/blade-system/dept/tree',
    method: 'get',
    params: {
      tenantId
    }
  })
}

// 获取主要事故列表
export const getMainFaultList = () => { 
  return request({
    url: '/api/blade-system/dict-biz/dictionary?code=main_accident_types_at_risk_points',
    method: 'get'
  })
}

// 获取人员列表
export const getUserList = () => { 
  return request({
    url: '/api/riskPoint/riskmanagement/getInternalStaff',
    method: 'get'
  })
}

// 获取lec_l
export const getLECL = () => { 
  return request({
    url: '/api/blade-system/dict-biz/dictionary?code=lec_l',
    method: 'get'
  })
}

// 获取lec_e
export const getLECE = () => { 
  return request({
    url: '/api/blade-system/dict-biz/dictionary?code=lec_e',
    method: 'get'
  })
}

// 获取lec_c
export const getLECC = () => { 
  return request({
    url: '/api/blade-system/dict-biz/dictionary?code=lec_c',
    method: 'get'
  })
}

// 获取ls_l
export const getLSL = () => { 
  return request({
    url: '/api/blade-system/dict-biz/dictionary?code=ls_l',
    method: 'get'
  })
}

// 获取ls_s
export const getLSS = () => { 
  return request({
    url: '/api/blade-system/dict-biz/dictionary?code=ls_s',
    method: 'get'
  })
}

// 添加风险评估
export const addRiskAssess = (row) => {
  return request({
    url: '/api/riskPoint/riskassessment/save',
    method: 'post',
    data: row
  })
}

// 获取风险评估列表
export const getahList = (current, size, params) => {
  return request({
    url: '/api/riskPoint/riskassessment/page',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

// 获取管控措施类型
export const getControlMeasureTypes = () => { 
  return request({
    url: '/api/blade-system/dict-biz/dictionary?code=control_measures',
    method: 'get'
  })
}

// 新增风险点管控
export const addRiskControl = (row) => {
  return request({
    url: '/api/riskPoint/riskcontrol/save',
    method: 'post',
    data: row
  })
}

// 查看风险点管控详情
export const getRiskControlDetail = (id) => {
  return request({
    url: '/api/riskPoint/riskcontrol/detail',
    method: 'get',
    params: {
      id
    }
  })
}

// 删除风险管控措施
export const removeRiskControlMeasure = (ids) => {
  return request({
    url: '/api/riskPoint/riskcontrolmeasures/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

// 获取所有管控措施
export const getControlMeasures = () => { 
  return request({
    url: '/api/riskPoint/controlmeasures/all',
    method: 'get'
  })
}

// 获取隐患级别
export const getDangerTypes = () => { 
  return request({
    url: '/api/blade-system/dict-biz/dictionary?code=control_measure_danger_level',
    method: 'get'
  })
}

// 获取风险等级字典
export const getRiskLevelList = () => { 
  return request({
    url: '/api/blade-system/dict-biz/dictionary?code=risk_level',
    method: 'get'
  })
}

// 获取国家标识列表
export const getCountryLogoList = () => {
  return request({
    url: '/api/riskPoint/resourcefilemgt/all?wjlx=1',
    method: 'get'
  })
}

// 获取承诺卡列表
export const getPromiseCardList = () => {
  return request({
    url: '/api/twoSinglesAndThreeCards/promisecard/list',
    method: 'get'
  })
}

// 获取应急处置卡列表
export const getEmergencyCardList = () => {
  return request({
    url: '/api/twoSinglesAndThreeCards/emergencycard/list',
    method: 'post'
  })
}

// 上传多个文件
export const uploadFiles = (files) => { 
  return request({
    url: '/api/fileManager/upload/files',
    method: 'post',
    data: files
  })
}